class MyArray<E>{//E是占位符代表当前类是泛型类
    public Object[]array=new Object[10];
    public void setArray(int pos,E val){
        array[pos]=val;
    }
    public E getArray(int pos){
        return (E)array[pos];//强制类型转换
    }
}
public class Test {
    public static void main(String[] args) {
          MyArray<Integer>myArray=new MyArray<>();
          myArray.setArray(1,20);
          Integer b= myArray.getArray(1);
          System.out.println(b);
          MyArray<String>myArray1=new MyArray<>();
          myArray1.setArray(1,"lalallalala");
        System.out.println(myArray1.getArray(1));
    }
    public static void main1(String[] args) {
        int a=10;
        Integer b=a;//装箱
        Integer c=Integer.valueOf(a);
        System.out.println(b);
        System.out.println(c);
        Integer d=10;
        int e=d;//拆箱
        int f=d.intValue();
        System.out.println(e);
        System.out.println(f);
    }
}
